FROM openshift/base-centos7

VOLUME ["/work","/airflow"]
WORKDIR /work
COPY ./Python-3.7.7.tar.xz ./requirements.txt /work/


RUN yum -y update && \
    yum -y groupinstall "Development tools" && \
    yum -y install cyrus-sasl-plain  cyrus-sasl-devel cyrus-sasl-gssapi gcc gcc-c++ cyrus-sasl-devel python-devel && \
    yum -y install libevent-devel zlib-devel && \
    # yum -y install libffi6=3.2.1-4 && \
    yum -y install libffi-devel && \
    yum -y install bzip2-devel openssl-devel ncurses-devel && \
    yum -y install libxml2-devel libxslt-devel && \
    yum -y install unixODBC-devel && \
    yum -y install xz-devel && \
    yum -y install readline-devel tk-devel gdbm-devel db4-devel && \
    yum -y install libpcap-devel xz-devel && \
    yum -y install libjpeg-devel && \
    echo 'alias shasum="sha1sum"' >> ~/.bashrc && \
    tar xvJf Python-3.7.7.tar.xz && rm Python-3.7.7.tar.xz && \
    cd ./Python-3.7.7 && \
    ./configure --prefix=/usr/local LDFLAGS="-Wl,-rpath /usr/local/lib" --with-ensurepip=install && \
    make && make altinstall && \
    yum clean all && \
    ln -s /usr/local/bin/pip3.7 /usr/local/bin/pip3 && \
    ln -s /usr/local/bin/python3.7 /usr/local/bin/python3 && \
    localedef -c -i en_US -f UTF-8 en_US.UTF-8 && \
    ln -snf /usr/share/zoneinfo/Asia/Shanghi /etc/localtime && echo 'Asia/Shanghi' > /etc/timezone

ENV PYTHON_VERSION=3.7.7 \
    PATH=$HOME/.local/bin/;$PATH \
    PYTHONUNBUFFERED=1 \
    PYTHONIOENCODING=UTF-8 \
    # LC_ALL=en_us.UTF-8 \
    LC_CTYPE=en_us \
    LANG=en_us.UTF-8 \
    APP_HOME=/work \
    AIRFLOW_HOME=/airflow

RUN pip3 install -r requirements.txt -i https://pypi.mirrors.ustc.edu.cn/simple

CMD ['bash']